package com.cskaoyan.config;

import org.springframework.web.servlet.support.AbstractAnnotationConfigDispatcherServletInitializer;

/**
 * - 加载Spring的配置文件application.xml
 * - 加载SpringMVC的配置文件application-mvc.xml
 * - DispatcherServlet的映射范围
 * @author stone
 * @date 2022/06/20 17:08
 */
public class ApplicationInitializer extends AbstractAnnotationConfigDispatcherServletInitializer {

    // 加载Spring的配置文件application.xml → 配置类
    @Override
    protected Class<?>[] getRootConfigClasses() {
        return new Class[]{SpringConfiguration.class};
    }

    // 加载SpringMVC的配置文件application-mvc.xml → 配置类
    @Override
    protected Class<?>[] getServletConfigClasses() {
        return new Class[]{MvcConfiguration.class};
    }

    // DispatcherServlet的映射范围
    @Override
    protected String[] getServletMappings() {
        return new String[]{"/"};
    }
}
